package homework;

import java.util.Arrays;

public class Day05Homework2 {
    public static void main(String[] args) {
        /*
        for(int num = 1;num <=9;num++){
            for(int i=1;i<=num;i++){
                System.out.print(i+"*"+num+"="+i*num+"\t");
            }
            System.out.println();
        }
        int[] a11 = new int[11];
        int[] a22 = new int[22];
        int[] a33 = {2,3,4};
        int[] a44 = new int[]{4,5,6};
        int[] arr4;
        arr4 = new int[]{1,2,3};
        System.out.println(arr4[2]);
        int[] arr = new int[3];
        System.out.println(arr.length);
        arr[0]=1111;
        arr[1]=2222;
        arr[2]=3333;
        System.out.println(arr[arr.length-1]);
        */
        /*
        int[] arr = new int[10];
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        */
        /*
        int[] arr = {1,2,3,4,5};
        arr = Arrays.copyOf(arr,arr.length+1);
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        int[] a= {11,22,33,44,55};
        int[] b=Arrays.copyOf(a,4);
        for(int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }
        */
        /*
        int[] c={10,20,30,40,50};
        int[] d= new int[6];
        System.arraycopy(c,0,d,1,5);
        for(int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }
        */
        /*
        Random rand = new Random();
        int[] arr = new int[5];
        for(int i=0;i<arr.length;i++){
            arr[i]=rand.nextInt(100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后");
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒输出");
        for(int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }
        */
        int[] arr = new int[10];
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        int max = arr[0];
        for(int i=0;i<arr.length;i++){
            if(arr[i]>max){
                max=arr[i];
            }
        }
        System.out.println("最大值"+max);

        arr = Arrays.copyOf(arr,arr.length+1);
        arr[arr.length-1] = max;
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
    }
}
